<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript">
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        btsubmit();
        return false;
    }
    function btsubmit() {
        var form=$("#searchForm");
        if($("#batch").is(':checked')){
//            $("#batchNo").hide();
//            $("#expireDate").hide();
//            $("#batchNo1").hide();
//            $("#expireDate1").hide();
            form.attr("onsubmit","return loadDivForm('mainCenterDiv','searchForm','${ctx}/csm/expStock/queryAll');")
        }else{
            form.attr("onsubmit","return loadDivForm('mainCenterDiv','searchForm','${ctx}/csm/expStock/queryAllBat');")
        }
        form.submit();
    }
</script>
<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <ul class="nav nav-tabs">
            <li class="active">
                <a href="#"   onclick="loadDiv('mainCenterDiv','${ctx}/csm/expStock/queryAllBat')">全院库存量列表</a>
            </li>
        </ul>
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="table-responsive no-border">
                    <div class="datatable-top">
                        <div class="pull-left">
                            <form:form id="searchForm" modelAttribute="expStock"  onsubmit="" method="post" class="form-inline">
                                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                                <label >消耗品类别:</label>
                                <sys:treeselect selectedParent="false" id="expType" name="expType" value="${expStock.expType}"
                                                update="${not empty expType}" labelName="expType1"
                                                labelValue="${expStock.expNameDict.expClassDict.className}"
                                                title="消耗品类别"
                                                url="/csm/expClassDict/treeData" extId="${expStock.id}" cssClass="form-control"/>
                                <label>消耗品名称：</label><form:input path="expName" htmlEscape="false" maxlength="50" class="form-control" />
                                <label>库存单位：</label><form:select path="storageId" name="storageId" htmlEscape="false" maxlength="50" class="form-control" >
                                <form:option value=""></form:option>
                                <c:forEach items="${list}" var="expStorageDept">
                                    <form:option value="${expStorageDept.id}">${expStorageDept.storageName}</form:option>
                                </c:forEach>
                            </form:select>
                                <label>供应商：</label><form:select path="expSupplierCata.id"  htmlEscape="false" maxlength="50" class="form-control" >
                                <form:option value=""></form:option>
                                <form:option value=""></form:option>
                                <c:forEach items="${firmList}" var="expSupplierCata">
                                    <form:option value="${expSupplierCata.id}">${expSupplierCata.supplierName}</form:option>
                                </c:forEach>
                            </form:select><br>
                                <label>合并批号：</label><form:checkbox path="batch" id="batch" htmlEscape="false"></form:checkbox>
                                <input id="btnSubmit" class="btn btn-primary" type="button" value="查询" onclick="btsubmit()"/>
                            </form:form>
                        </div>
                    </div>
                    <table id="contentTable" class="table table-bordered table-striped mg-t datatable">
                        <thead>
                        <tr>
                            <th>消耗品名称</th>
                            <%--<th>库存单位</th>--%>
                            <th>包装数量</th>
                            <th>包装规格</th>
                            <th>包装单位</th>
                            <th>最小规格</th>
                            <th>最小单位</th>
                            <th id = "batchNo" >批号</th>
                            <th id = "expireDate">有效期</th>
                            <th>大包装库存量</th>
                            <th>小包装库存量</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${page.list}" var="expStock">
                            <tr>
                                <td> ${expStock.expName}</td>
                                <%--<td> ${expStock.storageId}</td>--%>
                                <td> ${expStock.packageNum}</td>
                                <td> ${expStock.packageSpec}</td>
                                <%-- <td> ${expStock.packageUnits}</td>--%>
                                <td> ${fns:getDictLabel(expStock.packageUnits,'SPEC_UNIT','')}</td>
                                <td> ${expStock.minSpec}</td>
                                <%--  <td> ${expStock.minUnits}</td>--%>
                                <td> ${fns:getDictLabel(expStock.minUnits,'SPEC_UNIT','')}</td>
                                <td id="batchNo1"> ${expStock.batchNo}</td>
                                <td id="expireDate1"> <fmt:formatDate value="${expStock.expireDate}" pattern="yyyy-MM-dd"/></td>
                                <td> ${expStock.quantity/expStock.packageNum}</td>
                                <td> ${expStock.quantity}</td>
                            </tr>
                        </c:forEach>

                    </table>
                    <div class="pagination">${page}</div>
                </div>
            </div>
        </section>
    </div>
</div>